<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    var obj = {
      id: 1,
      title: '笔',
      price: 20,
      num: 2
    }
    // 得到的是obj所有属性名构成的数组
    var arr1 = Object.keys(obj)
    console.log(arr1)

    // 得到的是obj所有属性值构成的数组
    var arr2 = Object.values(obj)
    console.log(arr2)

  </script>
</body>
</html>